<?php
	$title = 'title_'.$this->lang;
?>
<div>
	<div class="box-h1">
		<h1 title="Search Books Result"><i>
			<?=Kohana::lang('site.viewcart')?> -> 
			<?=Kohana::lang('site.login')?> -> 
			<?=Kohana::lang('site.shipping')?> -> 
			<em><?=Kohana::lang('site.invoice')?></em> -> 
			<?=Kohana::lang('site.payment')?></i>
			<?=Kohana::lang('title.yourcart')?>
		</h1>
		<div class="box1 sform">
		<?php if(isset($carts['items']) and count($carts['items'])>0) { ?>
			<table id="cart-item-list" width="100%"><tr>
				<th width="50%"><?=Kohana::lang('site.product_name')?></th>
				<th width="10%">ISBN</th>
				<th width="10%" class="right"><?=Kohana::lang('site.price')?></th>
				<th width="10%" class="right"><?=Kohana::lang('site.quantity')?></th>
				<th width="10%" class="right"><?=Kohana::lang('site.subtotal')?></th>
			</tr><?php foreach($products as $product) { ?><tr>
				<td><?=$product->$title?></td>
				<td><?=$product->sku?></td>
				<td class="right">$<?=$product->price*1?></td>
				<td class="right"><?=$carts['items'][$product->id]['quantities']?></td>
				<td class="right">$<?=$product->price*$carts['items'][$product->id]['quantities']?></td>
			</tr><?php } ?><tr>
				<td style="background-color:#DADADA" colspan="5" class="right"><?=Kohana::lang('site.total')?>: $<?=$carts['subtotal']?></td>
			</tr></table>
			<br/><h3><?=Kohana::lang('site.consignee_information')?></h3>
			<ul><li>
				<span class="label"><?=Kohana::lang('site.first_name')?></span>
				<span class="required"></span>
				<span><?=$post['firstname']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.last_name')?></span>
				<span class="required"></span>
				<span><?=$post['lastname']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.email')?></span>
				<span class="required"></span>
				<span><?=$post['email']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.phone')?></span>
				<span class="required"></span>
				<span><?=$post['telephone']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.fax')?></span>
				<span class="required"></span>
				<span><?=$post['fax']?></span>
			</li></ul>
			<br/><h3><?=Kohana::lang('site.consignee_address')?></h3>
			<ul><li>
				<span class="label"><?=Kohana::lang('site.address_line')?> 1</span>
				<span class="required"></span>
				<span><?=$post['shipping_address_1']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.address_line')?> 2</span>
				<span class="required"></span>
				<span><?=$post['shipping_address_2']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.city')?></span>
				<span class="required"></span>
				<span><?=$post['shipping_city']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.state_province')?></span>
				<span class="required"></span>
				<span><?=$shipping_zone->name?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.country')?></span>
				<span class="required"></span>
				<span><?=$shipping_country->name?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.postal_code')?></span>
				<span class="required"></span>
				<span><?=$post['shipping_zip_code']?></span>
			</li></ul>
			<br/><h3><?=Kohana::lang('site.billing_address')?></h3>
			<ul><li>
				<span class="label"><?=Kohana::lang('site.address_line')?> 1</span>
				<span class="required"></span>
				<span><?=$post['billing_address_1']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.address_line')?> 2</span>
				<span class="required"></span>
				<span><?=$post['billing_address_2']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.city')?></span>
				<span class="required"></span>
				<span><?=$post['billing_city']?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.state_province')?></span>
				<span class="required"></span>
				<span><?=$billing_zone->name?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.country')?></span>
				<span class="required"></span>
				<span><?=$billing_country->name?></span>
			</li><li>
				<span class="label"><?=Kohana::lang('site.postal_code')?></span>
				<span class="required"></span>
				<span><?=$post['billing_zip_code']?></span>
			</li></ul>
			<br/><h3><?=Kohana::lang('site.express_information')?></h3>
			<ul><li>
				<span class="label"><?=Kohana::lang('site.service_type')?></span>
				<span class="required"></span>
				<span><?php $info = Config::item('ups.service_type'); echo $info[$post['selService']]; ?></span>
			</li><li>
				<span class="label"></span>
				<span class="required"></span>
				<span></span>
			</li></ul>
			<form action="<?=url::site('cart/checkout/saveorder')?>" onsubmit="return Validator.Validate(this,3)" method="post" id="register">
				<input type="hidden" name="firstname" value="<?=$post['firstname']?>"/>
				<input type="hidden" name="lastname" value="<?=$post['lastname']?>"/>
				<input type="hidden" name="telephone" value="<?=$post['telephone']?>"/>
				<input type="hidden" name="fax" value="<?=$post['fax']?>"/>
				<input type="hidden" name="email" value="<?=$post['email']?>"/>
				<input type="hidden" name="shipping_zone_id" value="<?=$post['shipping_zone_id']?>"/>
				<input type="hidden" name="shipping_country_id" value="<?=$post['shipping_country_id']?>"/>
				<input type="hidden" name="shipping_city" value="<?=$post['shipping_city']?>"/>
				<input type="hidden" name="shipping_zip_code" value="<?=$post['shipping_zip_code']?>"/>
				<input type="hidden" name="shipping_address_1" value="<?=$post['shipping_address_1']?>"/>
				<input type="hidden" name="shipping_address_2" value="<?=$post['shipping_address_2']?>"/>
				<input type="hidden" name="selResidential" value="<?=$post['selResidential']?>"/>
				<input type="hidden" name="selPackaging" value="<?=$post['selPackaging']?>"/>
				<input type="hidden" name="selService" value="<?=$post['selService']?>"/>
				<input type="hidden" name="selRate" value="<?=$post['selRate']?>"/>
				<input type="hidden" name="shipping_fare" value="<?=$post['shipping_fare']?>"/>
				<input type="Submit" name="saveorder" value="<?=Kohana::lang('site.place_order')?>"/>  <input type="button" name="editorder" value="修改订单"/>
			</form>
		<?php } else { ?>
			Your shopping cart is empty!
		<?php } ?>
			<div style="clear:both;"></div>
		</div>
	</div>
</div>
<script type="text/javascript">
	function getZones(country_id, domID)
	{
		ajax("<?=url::base()?>ajax/getzones/"+country_id, 'update', domID);
	}
</script>